import request from './request';

export const LoginApi = (params: ILoginParams): IR<string> => {
  return request.post('/1024/login', params); // 由于 request.post 返回了 Promise<AxiosResponse> 导致 LoginApi 的类型就是Promise<AxiosResponse> ， 在login组件里面调用的时候， then 的回调函数的 res 也是 AxiosResponse
};

// 首页的信息
export const HomePageApi = (): IR<IHomeDataModel> => request.get('/6666');

export const RegisterApi = (params: IRegisterParams): IR<Object> =>
  request.post('/1024/register', params);

// 根据actionCode获取题目的类型的接口
export const GetQuestionTypesByActionCodeApi = (
  actionCode: string
): IR<ISelectOption[]> => request.get(`/1314/${actionCode}/all`);

export const GetQuestionListApi = (params: IDataParams): IR<IPracticeList[]> =>
  request.post('/1314', params);
